package com.heima.model.wemedia.pojos;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.apache.ibatis.type.Alias;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 自媒体图文内容信息表
 * </p>
 *
 * @author itheima
 */
@Data
@TableName("wm_news")
public class WmNews implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;//主键
    @TableField("user_id")
    private Integer userId;//自媒体用户ID
    @TableField("title")
    private String title;//标题
    @TableField("content")
    private String content;//图文内容
    @TableField("type")
    private Short type;//文章布局 0:无图文章,1:单图文章,3:多图文章
    @TableField("channel_id")
    private Integer channelId;//图文频道ID
    @TableField("labels")
    private String labels;
    @TableField("created_time")
    private Date createdTime;//创建时间
    @TableField("submited_time")
    private Date submitedTime;//提交时间
    /**
     * 当前状态
     * 0 草稿
     * 1 提交（待审核）
     * 2 审核失败
     * 3 人工审核
     * 4 人工审核通过
     * 8 审核通过（待发布）
     * 9 已发布
     */
    @TableField("status")
    private Short status;
    @TableField("publish_time")
    private Date publishTime;//定时发布时间，不定时则为空
    @TableField("reason")
    private String reason;//拒绝理由
    @TableField("article_id")
    private Long articleId;//发布库文章ID
    @TableField("images")
    private String images;//图片用逗号分隔
    @TableField("enable")
    private Short enable;//0下架, 1上架

    //状态枚举类
    @Alias("WmNewsStatus")
    public enum Status {
        NORMAL((short) 0), SUBMIT((short) 1), FAIL((short) 2), ADMIN_AUTH((short) 3), ADMIN_SUCCESS((short) 4), SUCCESS((short) 8), PUBLISHED((short) 9);
        short code;

        Status(short code) {
            this.code = code;
        }

        public short getCode() {
            return this.code;
        }
    }

}